<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.ftb.ca.gov/efile"
                      xmlns="http://www.ftb.ca.gov/efile"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:irs="http://www.irs.gov/efile"
         elementFormDefault="qualified"
       attributeFormDefault="unqualified"
                    version="2018v3.0">

	<xsd:import namespace="http://www.irs.gov/efile"
	       schemaLocation="../../../IRS/2018v4.0_1120x+3.0_1065x/Common/efileTypes.xsd"/>

	<xsd:annotation>
		<xsd:documentation>
			<Description>CA FTB e-file Schema - Content models for e-file manifest file definitions</Description>
			<TaxYear>2018</TaxYear>
			<MaturityLevel>Draft Release</MaturityLevel>
			<ReleaseDate>November 1, 2018</ReleaseDate>
		</xsd:documentation>
	</xsd:annotation>

	<xsd:include schemaLocation="CA-InterfaceTypes.xsd"/>

<!-- ===================================  MANIFESTS  =================================== -->

	<!-- Transmission Manifest -->
	<xsd:element name="CA-TransmissionManifest" type="CA-TransmissionManifestType">
		<xsd:annotation>
			<xsd:documentation>an instance of a transmission manifest</xsd:documentation>
		</xsd:annotation>
	</xsd:element>
	<xsd:complexType name="CA-TransmissionManifestType">
		<xsd:annotation>
			<xsd:documentation>manifest of a transmission's contents</xsd:documentation>
		</xsd:annotation>

		<xsd:sequence>
			<!-- Common Transmission Elements -->
			<xsd:group ref="CA-CommonTransmissionElements"/>

			<!-- Submission Data List -->
			<xsd:element name="SubmissionDataList" type="CA-SubmissionDataListType">
				<xsd:annotation>
					<xsd:documentation>List of submission data (Submission ID and Electronic Postmark).</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>

		<!-- Transmission Manifest Version -->
		<xsd:attribute name="transmissionManifestVersion" type="xsd:string" use="optional"/>

		<!-- Imported IRS Schema Version -->
		<xsd:attribute name="importedIrsSchemaVersion" type="xsd:string" use="optional"/>
	</xsd:complexType>

	<!-- Submission Manifest -->
	<xsd:element name="CA-SubmissionManifest" type="CA-SubmissionManifestType">
		<xsd:annotation>
			<xsd:documentation>an instance of a submission manifest</xsd:documentation>
		</xsd:annotation>
	</xsd:element>
	<xsd:complexType name="CA-SubmissionManifestType">
		<xsd:annotation>
			<xsd:documentation>manifest of a submission's contents</xsd:documentation>
		</xsd:annotation>

		<xsd:sequence>
			<!-- Common Submission/Acknowledgement Elements -->
			<xsd:group ref="CA-CommonSubmissionAndAcknowledgementElements"/>

			<!-- Submission Category -->
			<xsd:element name="SubmissionCategory" type="CA-SubmissionCategoryType">
				<xsd:annotation>
					<xsd:documentation>Identifies the submission category.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- CA Business Entity ID -->
			<xsd:element name="CA-BusinessEntityId" type="CA-BusinessEntityIdType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>(Optional) The filers' unique California BE identifier (depending on form-type filed):  Corporation # [7 digits], FEIN (Federal Employment ID #) [9 digits], SOSG (Secretary of State General Partnership #) [12 digits], or TEMP(orary #) [7 digits].</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Name Control -->
			<xsd:element name="NameControl" type="irs:BusinessNameControlType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>(Optional) Business Name Control of the filer (Legal Characters: A-Z, 0-9, hyphen, and ampersand; Illegal Characters: spaces and symbols).</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- IRS Submission ID -->
			<xsd:element name="IRSSubmissionId" type="CA-SubmissionIdType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>(Optional) The submission ID of an IRS submission that the processing of this state submission depends on.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>

		<!-- Submission Manifest Version -->
		<xsd:attribute name="submissionManifestVersion" type="xsd:string" use="optional"/>

		<!-- Imported IRS Schema Version -->
		<xsd:attribute name="importedIrsSchemaVersion" type="xsd:string" use="optional"/>
	</xsd:complexType>

<!-- ===================================  COMMON COMPLEX TYPES  =================================== -->

	<!-- Type for Submission Data List -->
	<xsd:complexType name="CA-SubmissionDataListType">
		<xsd:annotation>
			<xsd:documentation>list of attached submissions' data</xsd:documentation>
		</xsd:annotation>

		<xsd:sequence>
			<!-- Count -->
			<xsd:element name="Count" type="xsd:positiveInteger">
				<xsd:annotation>
					<xsd:documentation>A count of the number of items in the list (submissions within this transmission).</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Submission Data -->
			<xsd:element name="SubmissionData" type="CA-SubmissionDataType" minOccurs="1" maxOccurs="unbounded">
				<xsd:annotation>
					<xsd:documentation>Submission Data</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>

	<!-- Type for Submission Data -->
	<xsd:complexType name="CA-SubmissionDataType">
		<xsd:annotation>
			<xsd:documentation>data about an attached submission</xsd:documentation>
		</xsd:annotation>

		<xsd:sequence>
			<!-- Submission ID -->
			<xsd:element name="SubmissionId" type="CA-SubmissionIdType">
				<xsd:annotation>
					<xsd:documentation>Each Submission ID will match up with a corresponding Submission ID in the manifest of one of the attached submissions.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Electronic Postmark -->
			<xsd:element name="ElectronicPostmark" type="irs:TimestampType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>(Optional) Submission Data's Electronic Postmark</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
</xsd:schema>
