<?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="2018v4.1">

	<xsd:import namespace="http://www.irs.gov/efile"
	       schemaLocation="../../../IRS/2018v5.3_1120x+4.1_1065x/Common/efileTypes.xsd"/>

	<xsd:annotation>
		<xsd:documentation>
			<Description>CA FTB e-file Schema - Element groups and types commonly used across interface schema files.</Description>
			<TaxYear>2018</TaxYear>
			<MaturityLevel>Production Release</MaturityLevel>
			<ReleaseDate>January 23, 2020</ReleaseDate>
		</xsd:documentation>
	</xsd:annotation>

<!-- ===================================  ELEMENT GROUPS  =================================== -->

	<!-- Common Transmission Elements -->
	<xsd:group name="CA-CommonTransmissionElements">
		<xsd:annotation>
			<xsd:documentation>common transmission-level elements group</xsd:documentation>
		</xsd:annotation>

		<xsd:sequence>
			<!-- Transmission ID -->
			<xsd:element name="TransmissionId" type="CA-TransmissionIdType">
				<xsd:annotation>
					<xsd:documentation>A globally unique ID provided by the transmitter that must be unique for the transmitter for the tax year.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Transmitter ETIN -->
			<xsd:element name="ETIN" type="irs:ETINType">
				<xsd:annotation>
					<xsd:documentation>Electronic Transmitter Identification Number of the transmitter sending the transmission.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Transmission Category -->
			<xsd:element name="TransmissionCategory" type="CA-TransmissionCategoryType">
				<xsd:annotation>
					<xsd:documentation>Type of transmission - [T]est or [P]roduction.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Transmission Timestamp -->
			<xsd:element name="TransmissionTimestamp" type="irs:TimestampType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>(Optional) The transmitter's time of transmission to FTB.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:group>

	<!-- Common Submission/Acknowledgement Elements -->
	<xsd:group name="CA-CommonSubmissionAndAcknowledgementElements">
		<xsd:annotation>
			<xsd:documentation>common submission/acknowledgement-level elements group</xsd:documentation>
		</xsd:annotation>

		<xsd:sequence>
			<!-- Submission ID -->
			<xsd:element name="SubmissionId" type="CA-SubmissionIdType">
				<xsd:annotation>
					<xsd:documentation>A globally unique identifier for the received submission created by the originator.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- EFIN -->
			<xsd:element name="EFIN" type="irs:EFINType">
				<xsd:annotation>
					<xsd:documentation>IRS-provided Electronic Filer Identification Number of the originator of the submission.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Government Code -->
			<xsd:element name="GovernmentCode" type="CA-GovernmentCodeType">
				<xsd:annotation>
					<xsd:documentation>Identifies the government entity where the submission is to be filed - IRS, state, or other jurisdiction codes (always "CAST" for State of California).</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Submission Type -->
			<xsd:element name="SubmissionType" type="CA-SubmissionType">
				<xsd:annotation>
					<xsd:documentation>Identifies the type of document being filed, using State form numbers or identifiers.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Tax Year -->
			<xsd:element name="TaxYear" type="irs:YearType">
				<xsd:annotation>
					<xsd:documentation>The tax year the submission applies to.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:group>

<!-- ===================================  SIMPLE TYPES  =================================== -->

	<!-- Type for CA Business Entity ID -->
	<xsd:simpleType name="CA-BusinessEntityIdType">
		<xsd:annotation>
			<xsd:documentation>7-12 digits (numeric)</xsd:documentation>
		</xsd:annotation>

		<xsd:restriction base="irs:NumericType">
			<xsd:minLength value="7"/>
			<xsd:maxLength value="12"/>
		</xsd:restriction>
	</xsd:simpleType>

	<!-- Type for Government Code -->
	<xsd:simpleType name="CA-GovernmentCodeType">
		<xsd:annotation>
			<xsd:documentation>one-item enumerator: [CA]lifornia[ST]ate</xsd:documentation>
		</xsd:annotation>

		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="CAST">
				<xsd:annotation>
					<xsd:documentation>California Franchise Tax Board</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
		</xsd:restriction>
	</xsd:simpleType>

	<!-- Type for Submission Type -->
	<xsd:simpleType name="CA-SubmissionType">
		<xsd:annotation>
			<xsd:documentation>submission type enumerator</xsd:documentation>
		</xsd:annotation>

		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="100">
				<xsd:annotation>
					<xsd:documentation>CA Form 100</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>

			<xsd:enumeration value="100S">
				<xsd:annotation>
					<xsd:documentation>CA Form 100S</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>

			<xsd:enumeration value="100W">
				<xsd:annotation>
					<xsd:documentation>CA Form 100W</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>

			<xsd:enumeration value="199">
				<xsd:annotation>
					<xsd:documentation>CA Form 199</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>

			<xsd:enumeration value="565">
				<xsd:annotation>
					<xsd:documentation>CA Form 565</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>

			<xsd:enumeration value="568">
				<xsd:annotation>
					<xsd:documentation>CA Form 568</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>

			<xsd:enumeration value="CorpPartPayment">
				<xsd:annotation>
					<xsd:documentation>CA Stand Alone EFW CorpPart Payment</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
		</xsd:restriction>
	</xsd:simpleType>

	<!-- Type for Submission Category -->
	<xsd:simpleType name="CA-SubmissionCategoryType">
		<xsd:annotation>
			<xsd:documentation>submission category enumerator</xsd:documentation>
		</xsd:annotation>

		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="CORP">
				<xsd:annotation>
					<xsd:documentation>Corporation</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>

			<xsd:enumeration value="EO">
				<xsd:annotation>
					<xsd:documentation>Exempt Organization</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>

			<xsd:enumeration value="PART">
				<xsd:annotation>
					<xsd:documentation>Partnership</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
		</xsd:restriction>
	</xsd:simpleType>

	<!-- Type for Submission ID -->
	<xsd:simpleType name="CA-SubmissionIdType">
		<xsd:annotation>
			<xsd:documentation>20 digits (EFIN + ccyyddd + 7-character lower case alphanumeric)</xsd:documentation>
		</xsd:annotation>

		<xsd:restriction base="xsd:string">
			<xsd:pattern value="[0-9]{13}[a-z0-9]{7}"/>
		</xsd:restriction>
	</xsd:simpleType>

	<!-- Type for Transmission Category -->
	<xsd:simpleType name="CA-TransmissionCategoryType">
		<xsd:annotation>
			<xsd:documentation>transmission category enumerator</xsd:documentation>
		</xsd:annotation>

		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="T">
				<xsd:annotation>
					<xsd:documentation>Test</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>

			<xsd:enumeration value="P">
				<xsd:annotation>
					<xsd:documentation>Production</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
		</xsd:restriction>
	</xsd:simpleType>

	<!-- Type for Transmission ID -->
	<xsd:simpleType name="CA-TransmissionIdType">
		<xsd:annotation>
			<xsd:documentation>20 digits (ETIN + ccyyddd + 8-character lower case alphanumeric)</xsd:documentation>
		</xsd:annotation>

		<xsd:restriction base="xsd:string">
			<xsd:pattern value="[0-9]{12}[a-z0-9]{8}"/>
		</xsd:restriction>
	</xsd:simpleType>
</xsd:schema>
